Skip to content

[Do not merge until MSAL.NET 4.0 releases] Jmprieur/msal4.0 #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 4, 2019

Conversation

jmprieur
Copy link
Contributor

Purpose

Update the sample to MSAL.NET 4.0

  • leverages the new async serializer (in the SessionCacheProviders)
  • makes it easier to use the SQL token cache provider

Does this introduce a breaking change?

[ ] Yes
[x ] No, but this only builds with MSAL.NET >= 4.0

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[ x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
  • Test the code
    Follow the README.md

jmprieur added 4 commits May 31, 2019 14:42
Using the async serialization in the SessionTokenCacheProviders
Updating README.md with a sample connection string, for localdb
- proposing a localdb connection string as a comment in the appsettings.json
- Now, uncommenting the comments still builds (and it's obvious now which), now builds
  correctly (renamed tokenCacheDbContext into tokenCacheDbContextForCreation as it used
  to conflict with the tokenCacheDbContext in the AddScoped block
@@ -119,9 +125,9 @@ public void Clear()
/// Triggered right before MSAL needs to access the cache. Reload the cache from the persistence store in case it changed since the last access.
/// </summary>
/// <param name="args">Contains parameters used by the MSAL call accessing the cache.</param>
private void AppTokenCacheBeforeAccessNotification(TokenCacheNotificationArgs args)
private async Task AppTokenCacheBeforeAccessNotificationAsync(TokenCacheNotificationArgs args)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And therefore the callback are async

{
this.HttpContext.Session.LoadAsync().Wait();
await this.HttpContext.Session.LoadAsync();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we don't need to block any longer!


//var tokenCacheDbContext = new TokenCacheDbContext(tokenCacheDbContextBuilder.Options);
//tokenCacheDbContext.Database.EnsureCreated();
/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transforming in /* comments so that it's obvious what to uncomment

Copy link
Contributor Author

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left comments to explain the PR


var tokenCacheDbContextForCreation = new TokenCacheDbContext(tokenCacheDbContextBuilder.Options);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed tokenCacheDbContext -> tokenCacheDbContextForCreation as there was a conflict

@jmprieur jmprieur changed the title Jmprieur/msal4.0 [Do not merge until MSAL.NET 4.0 releases] Jmprieur/msal4.0 May 31, 2019
@jmprieur jmprieur merged commit 8ecf6d5 into master Jun 4, 2019
@jmprieur jmprieur deleted the jmprieur/msal4.0 branch September 26, 2019 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants